package deep6jvmdvm;

/*
class 初始化和对象的创建顺序
*/
public class InitOder {
    public static void main(String[] args) {
        Parent2 p = new Child2();
        System.out.println("---------------------------------------------------------");
        p = new Child2();
    }

    static class Child2 extends Parent2 {
        Child2() {
            System.out.println("Child2 constructor ! ");

        }

        static {
            System.out.println("Child2 stact  block! ");
        }

        {
            System.out.println("Child2 non - stact  block! ");
        }
    }

    static class Parent2 {
        Parent2() {
            System.out.println("Parent2 constructor ! ");

        }

        static {
            System.out.println("Parent2 stact  block! ");
        }

        {
            System.out.println("Parent2 non - stact  block! ");
        }
    }

}
